.class Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;
.super Ljava/lang/Object;
.source "ViewPagerAdapter.java"

# interfaces
.implements Landroid/widget/AdapterView$OnItemClickListener;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->instantiateItem(Landroid/view/View;I)Ljava/lang/Object;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Landroid/widget/AdapterView$OnItemClickListener;"
    }
.end annotation


# instance fields
.field final synthetic this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

.field private final synthetic val$p:I


# direct methods
.method constructor <init>(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 1
    iput-object p1, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    iput p2, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->val$p:I

    .line 189
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 9
    .parameter
    .parameter "v"
    .parameter "position"
    .parameter "id"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView",
            "<*>;",
            "Landroid/view/View;",
            "IJ)V"
        }
    .end annotation

    .prologue
    .line 195
    .local p1, l:Landroid/widget/AdapterView;,"Landroid/widget/AdapterView<*>;"
    :try_start_0
    iget-object v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->footerViewLoading:Landroid/view/View;
    invoke-static {v4}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$9(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Landroid/view/View;

    move-result-object v4

    if-ne p2, v4, :cond_0

    .line 216
    :goto_0
    return-void

    .line 199
    :cond_0
    new-instance v2, Landroid/content/Intent;

    iget-object v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;
    invoke-static {v4}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$3(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Landroid/app/Activity;

    move-result-object v4

    .line 200
    const-class v5, Lcom/opongo/blogapp/activities/PostViewScrollActivity;

    .line 199
    invoke-direct {v2, v4, v5}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 201
    .local v2, intent:Landroid/content/Intent;
    const-string v4, "POSITION"

    add-int/lit8 v5, p3, -0x1

    invoke-virtual {v2, v4, v5}, Landroid/content/Intent;->putExtra(Ljava/lang/String;I)Landroid/content/Intent;

    .line 202
    const-string v4, "TABLENAME"

    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    iget-object v5, v5, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v5}, Lcom/opongo/blogapp/manager/DatabaseManager;->getTableName()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v2, v4, v5}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 204
    iget-object v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    iget-object v4, v4, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 205
    iget-object v5, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    iget-object v5, v5, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v5}, Lcom/opongo/blogapp/manager/DatabaseManager;->getTableName()Ljava/lang/String;

    move-result-object v5

    iget v6, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->val$p:I

    .line 204
    invoke-virtual {v4, v5, v6}, Lcom/opongo/blogapp/manager/DatabaseManager;->queryForBlogTypeID(Ljava/lang/String;I)I

    move-result v0

    .line 207
    .local v0, blogTypeID:I
    iget-object v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    iget-object v5, v4, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->query:Ljava/lang/String;

    const/4 v4, 0x3

    new-array v6, v4, [Ljava/lang/Object;

    const/4 v4, 0x0

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v7

    aput-object v7, v6, v4

    const/4 v4, 0x1

    .line 208
    iget-object v7, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->order:[Ljava/lang/String;
    invoke-static {v7}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$1(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)[Ljava/lang/String;

    move-result-object v7

    iget v8, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->val$p:I

    aget-object v7, v7, v8

    aput-object v7, v6, v4

    const/4 v7, 0x2

    iget-object v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->DESC:[Ljava/lang/Boolean;
    invoke-static {v4}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$2(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)[Ljava/lang/Boolean;

    move-result-object v4

    iget v8, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->val$p:I

    aget-object v4, v4, v8

    invoke-virtual {v4}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v4

    if-eqz v4, :cond_1

    const-string v4, "DESC"

    :goto_1
    aput-object v4, v6, v7

    .line 207
    invoke-static {v5, v6}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    .line 210
    .local v3, queryFormat:Ljava/lang/String;
    const-string v4, "QUERY"

    invoke-virtual {v2, v4, v3}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 212
    iget-object v4, p0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter$2;->this$0:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    #getter for: Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->activity:Landroid/app/Activity;
    invoke-static {v4}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->access$3(Lcom/opongo/blogapp/adapter/ViewPagerAdapter;)Landroid/app/Activity;

    move-result-object v4

    invoke-virtual {v4, v2}, Landroid/app/Activity;->startActivity(Landroid/content/Intent;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 213
    .end local v0           #blogTypeID:I
    .end local v2           #intent:Landroid/content/Intent;
    .end local v3           #queryFormat:Ljava/lang/String;
    :catch_0
    move-exception v1

    .line 214
    .local v1, e:Ljava/lang/Exception;
    sget-object v4, Ljava/lang/System;->out:Ljava/io/PrintStream;

    const-string v5, "Nay, cannot get the selected index"

    invoke-virtual {v4, v5}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    goto :goto_0

    .line 208
    .end local v1           #e:Ljava/lang/Exception;
    .restart local v0       #blogTypeID:I
    .restart local v2       #intent:Landroid/content/Intent;
    :cond_1
    :try_start_1
    const-string v4, "ASC"
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_1
.end method
